//
//  ViewController.m
//  2016.6.28 - 练习MD5加密
//
//  Created by willphonez on 16/6/28.
//  Copyright © 2016年 willphonez. All rights reserved.
//

#import "ViewController.h"
#import "NSString+Hash.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    // MD5加密
//    NSString *str = @"2332";
//    NSLog(@"%@",[str md5String]);
    
    // MD5加密加盐
//    NSString *salt = @"fsgdsgsgs2323434@$#^%$^$^$dsf";
//    NSString *str = @"2332";
//    NSString *string = [str stringByAppendingString:salt];
//    NSLog(@"%@",[string md5String]);
    
    // MD5字符串乱序
//    NSString *string = @"23455";
//    NSString *lastStr = [string substringFromIndex:3];
//    NSString *firstStr = [string substringToIndex:3];
//    NSString *strin = [lastStr stringByAppendingString:firstStr];
//    NSLog(@"%@",[strin md5String]);
    
    // 消息摘要认证
    NSString *key = @"abc";
    NSString *string = @"12345";
    NSLog(@"%@",[string hmacMD5StringWithKey:key]);
}

@end
